home *** CD-ROM | disk | FTP | other *** search
/ Light ROM 3 / Light ROM 3 - Disc 2.iso / programs / amiga / macromkr / rexxscri.lha / REXXscripts / loadiff2.rexx < prev    next >
OS/2 REXX Batch file  |  1980-01-05  |  3KB  |  96 lines

  1. /*
  2.  LoadIFF.rexx
  3.  ======================================================================
  4.  Usage:
  5.  rx LoadIFF <filename>
  6.  
  7.  where <filename> is a complete path to any valid IFF picture file
  8.  note: no spaces allowed in filename or path!
  9.  
  10.  Purpose:
  11.  To allow external scripts to load images into Black Belt System's
  12.  Imagemaster. The primary buffer is killed, and the given filename
  13.  is then loaded.
  14.  
  15.  This script assumes that Imagemaster is already running. This is not a
  16.  "PI" rexx file, but is intended to be run from a shell.
  17.  
  18.  Don't attempt to run this from Imagemaster's sequence processor - it
  19.  won't work!
  20.  
  21.  Written by: James Hastings-Trew, based on work by Pete Patterson
  22.  ======================================================================
  23. */
  24.  
  25. parse arg filename
  26. /*
  27.  check args and print help if wrong ===================================
  28.  */
  29. if filename = "" then do
  30.     do hlpline = 2 to 22 by 1
  31.         say sourceline(hlpline)
  32.         end
  33.     exit 0
  34.     end
  35. prtnme = 'IM_Port'
  36. cmdpath = 'cmpi:'
  37. /*
  38.  open rexxsupport.library -- needed for some functions ================
  39.  */
  40. if ~show('L',"rexxsupport.library") then do
  41.   if addlib('rexxsupport.library',0,-30,0) then do
  42.       /* everything's ok */
  43.     end;
  44.   else do
  45.     say 'We Have A Library Problem, Unable To Load "rexxsupport.library"';
  46.     say 'Cannot operate JPEG.rexx without this library - sorry!';
  47.     exit 10;
  48.     end;
  49.   end;
  50. /*
  51.  expand file name =====================================================
  52.  */
  53. filename = strip(filename)
  54. if index(filename,':') = 0 then do
  55.     cdr = pragma(D)
  56.     if (right(cdr,1)~=':')&(right(cdr,1)~='/')&(cdr~='') then cdr=cdr||'/'
  57.     filename = cdr||filename
  58.      end
  59. /*
  60.  seperate path and filename ===========================================
  61.  */
  62. tmpn = reverse(filename)
  63. seploc = 0
  64. if index(tmpn,'/')~=0 then seploc=(length(tmpn))-(index(tmpn,'/'))+1
  65. else do
  66.     if (index(tmpn,':')~=0) then seploc=(length(tmpn))-(index(tmpn,':'))+1
  67.     end
  68. thispath = left(filename,seploc)
  69. filename = substr(filename,seploc+1)
  70. /*
  71.  Kill primary buffer ==================================================
  72.  */
  73. address(prtnme)
  74. 'autoredraw 0'
  75. options results
  76. 'current'
  77. bufdata = result
  78. options
  79. parse var bufdata bname ',' bnum ',' bx ',' by ',' btot ',' bmem ',' bparname ',' bparnum
  80. if bname ~= '<none>' then do
  81.     address(prtnme)
  82.     'killbuff '||bnum
  83.     address
  84.     end
  85. /*
  86.  Find and load new image ==============================================
  87.  */
  88. options results
  89. call setclip(filename,thispath)
  90. address(prtnme)
  91. 'imagepath '||thispath
  92. 'load '||filename
  93. address
  94. options
  95. exit 0
  96.